import { isObj } from '../core/isObj'
import { isArr } from '../core/isArr'
import { extend } from './extend'
// 11094
/**
 * 对指定对象进行浅复制
 * const obj = [{ a: 1 }, { a: 2 }];
   const obj4 = mxUtils.clone(obj);
   console.log(obj[0] === obj4[0]); // -> true
 * dependencies isObj isArr extend
 * @param {*} obj 
 */
export function clone (obj) {
  if (!isObj(obj)) return obj;
  return isArr(obj) ? obj.slice() : extend({}, obj);
}